<?
include ('Connections/connection.php');


$id_stanza = $_GET['id_stanza'];

if ($id_stanza == "") {	
	$id_stanza = GetSQLValue("select id_stanza from stanze order by id_stanza asc");	
}

$titolo_stanza = GetSQLValue("select Titolo from stanze where id_stanza=".$id_stanza);

$query = "select * from options";

$resultID = mysql_query($query, $db) ;
$row = mysql_fetch_assoc($resultID);

$offset_x = $row["offset_x"];
$offset_y = $row["offset_y"];

$stanze = mysql_query("select * from stanze where id_stanza=".$id_stanza, $setroma) or die(mysql_error());
$row_stanza = mysql_fetch_assoc($stanze);

$sfondo_stanza = $row_stanza['Path'];





?>

<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="thickbox.js"></script>
<script type="text/javascript" src="framework/effects.js"></script>
<script type="text/javascript" src="scripts/BubbleTooltips.js"></script>
<style type="text/css" media="all">@import "thickbox.css";</style>
<title><?php echo GetSetting("titolo")." - ".$titolo_stanza ?></title>
</head>
<body>
<script type="text/javascript" src="scripts/wz_dragdrop.js"></script>

<script type="text/javascript">
window.onload=function(){enableTooltips()};
</script>


<div id="background" style="opacity: 0; MozOpacity:0; KhtmlOpacity:0; filter:alpha(opacity=0); position:absolute; left: <? echo $offset_x;?>; top: <? echo $offset_y;?>">
<img src="userfiles/rooms/<?php echo $sfondo_stanza; ?>"></div>

<?php

$str_inizializzazione = "";

$query = "select * from oggetto where id_stanza=".$id_stanza;

$resultID = mysql_query($query, $db) ;



for($x = 0 ; $x < mysql_num_rows($resultID) ; $x++){
    $row = mysql_fetch_assoc($resultID);
//opacity: 0; MozOpacity:0; KhtmlOpacity:0; 
?>


<div id="oggetto-<?php echo $row["id_oggetto"]; ?>" style="opacity: 0; MozOpacity:0; KhtmlOpacity:0; filter:alpha(opacity=0); position: absolute; left:<?echo $row["X"]+$offset_x; ?>; top:<?echo $row["Y"]+$offset_y ; ?>;">
<a href="dettaglio.php?id_oggetto=<?echo $row["id_oggetto"];?>" class="thickbox" title="<?echo $row["Nome"]; ?>">
<img src="userfiles/images/<?echo $row["Immagine"]; ?>" <?php  if ($row["W"] !=0) { ?>style="width:<?echo $row["W"]; ?>;height:<?echo $row["H"]; ?>;"  <?php } ?>border=0>
</a>



</div>

<?php
$str_inizializzazione .= "setTimeout(\"opacity('oggetto-".$row["id_oggetto"]."', 1, 100, 800)\",".(($x+1)*300+500).");\n"; 
}
?>
<script type="text/javascript">
function dissolvenza() {
setTimeout("opacity('background', 1, 100, 800)",300);
<?php echo $str_inizializzazione;?>	
}
dissolvenza();
</script>

</body>
</html>
